/*
 * @author: sanbao
 * @Date: 2022-07-22 19:29:40
 */
const TOKEN_KEY = "token"
const USER_LIST = "userlist"

// 存 token
function setToken(token: string) {
    localStorage.setItem(TOKEN_KEY, token)
}
// 取 token
function getToken() {
    return localStorage.getItem(TOKEN_KEY)
}
// 存 用户信息 
function setUserList(userlist: any) {
    localStorage.setItem(USER_LIST, JSON.stringify(userlist))
    // JSON.parse()
}
//取 用户信息
function getUserList() {
    return localStorage.getItem(USER_LIST)
}
// 退出
function removeUser() {
    return localStorage.removeItem(TOKEN_KEY), localStorage.removeItem(USER_LIST)
}
// 抛
export {
    setToken,
    getToken,
    setUserList,
    getUserList,
    removeUser
}